package com.webframe.web.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 输出excel，下载
 * Created on 2013-7-17-上午10:50:14
 * @author xiaokui.li
 */
@Controller
@RequestMapping("/generateExcel")
public class GenerateExcelController extends BaseController
{

	@RequestMapping
	public String index(HttpServletRequest request, HttpServletResponse response)
				throws Exception
	{
		response.setHeader("Content-Type", "application/force-download");
		response.setHeader("Content-Type", "application/octet-stream");
		String fileName = new String(request.getParameter("title").getBytes("gb2312"), "ISO8859-1");
		response.setHeader("Content-Disposition", "attachment;filename="+ fileName + ".xls");
		outWrite(response, request.getParameter("exportContent"));
		return null;
	}
}
